// https://leetcode.cn/problems/find-all-numbers-disappeared-in-an-array/
// Created by ade on 2022/8/5.
//
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

using namespace std;

class Solution {
public:
    // 暴力法
    vector<int> findDisappearedNumbers1(vector<int> &nums) {
        unordered_map<int, int> um;
        for (auto i : nums) {
            um[i] = 1;
        }
        vector<int> res;
        for (int i = 1; i <= nums.size(); i++) {
            if (um.find(i) == um.end()) {
                res.push_back(i);
            }
        }
        return res;
    }
};

int main() {
    Solution so;
    vector<int> a = {4,3,2,7,8,2,3,1};
    auto res = so.findDisappearedNumbers(a);
    for (auto i : res) {
        cout << i << ",";
    }
    cout << endl;
    return 0;
}